<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="../css/reset.css">
    <script src="../js/jquery-3.6.0.min.js"></script>
    <style>
        /* #box::-webkit-scrollbar{
            display: none;
        } */

        .wrap {
            width: 400px;
            height: 400px;
            background-color: grey;
            margin: 50px;
            overflow: hidden;
            position: relative;
        }

        .sub {
            width: 200px;
            height: 200px;
            background-color: pink;
            margin: 100px;
            overflow: hidden;
            /* position: relative; */
        }

        .box {
            width: 100px;
            height: 100px;
            background-color: #6ff;
            position: absolute;
            left: 50px;
            top: 50px;
        }
    </style>
</head>

<body>
    <div class="wrap">
        <div class="sub">
            <div class="box"></div>
        </div>
    </div>
</body>
<script>

    // position()  始终获取匹配的元素相对于包含块(定位的参照物)的偏移(body)  => {left,top}

    console.log($(".box").position());


</script>

</html>